package androidx.gdata.documents.xml;

import org.w3c.dom.Node;

import androidx.gdata.Category;
import androidx.gdata.LinkUrl;
import androidx.gdata.documents.Entry;
import androidx.gdata.xml.CategoryDeserializer;
import androidx.gdata.xml.ThingWithLinksDeserializer;

public class EntryDeserializer extends ThingWithLinksDeserializer<Entry> {
  
  private static final CategoryDeserializer categoryDeserializer =
    new CategoryDeserializer();

  @Override
  public Entry build(Node node) {
    this.node = node;
    String title = getText("title");
    Node categoryNode = this.getChildNode("category");
    Category category = null;
    if (categoryNode != null) {
      category = categoryDeserializer.build(categoryNode);
    }
    LinkUrl[] linkUrls = getLinks();
    return new Entry(title, category, linkUrls);
  }

}
